**************************************
** Logan Strother                   **
** lstrothe@purdue.edu              **
** "Case Salience and the Influence **
**  of External Constraints on the  **
**  Supreme Court"                  **
** Journal of Law and Courts        **
** 1 Aug 2016 - 6 Aug 2018          **
**************************************

clear all
version 14.2
set more off, permanently 
set matsize 800

* log [specify destination]

*** NOTE that there are two datasets used in the analysis in this article ***

* Correlations reported in text
use "Strother_JLC_Constraints_Dataset_1.dta"
pwcorr nyt pre3
clear

* Table 1: Influnce of Pub Opinion on SCOTUS Decisions (Time Series)
use "Strother_JLC_Constraints_Dataset_2.dta" 
*Replicate Casillas, Enns, and Wohlfarth (2011: Table 2)
*CEW Model 1:Non-Salient Reversals
ivregress 2sls d.nosal_rev l.nosal_rev d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label replace
*CEW Model 2: Salient Reversals
ivregress 2sls d.sal_rev l.sal_rev d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
* Replications using CLR pre-decision salience measure
*Rep Model 1: Non-salient (median-plus) reversals
ivregress 2sls d.nosal_rev_new l.nosal_rev_new d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
*Rep Model 2: Salient (median-plus) reversals
ivregress 2sls d.sal_rev_new l.sal_rev_new d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
*Rep Model 3: Non-salient (top 15%) reversals
ivregress 2sls d.nosal15 l.nosal15 d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
*Rep Model 4: Salient (TOP 15%) reversals
ivregress 2sls d.sal15 l.sal15 d.mood l.mood d.zsc_med l.zsc_med (d.zmq_med l.zmq_med = d.perchcpi d.unem d.policylib d.def_budg d.homicide d.inequality l.perchcpi l.unem l.policylib l.def_budg l.homicide l.inequality)
outreg2 using JLC_Table1.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
clear

* Table 2: Impact of External Constraints on SCOTUS Decision (Cross Sectional)
use "Strother_JLC_Constraints_Dataset_1.dta" 
drop if decisionDirection==3
keep if decisionType==1|decisionType==6|decisionType==7
*Replicate Hall (2014: Table 1)
logit decisionDirection c.zcourt c.zmood##i.lat##i.nyt c.zcong##i.lat##i.nyt i.naturalCourt##i.nyt##i.lat, r
outreg2 using JLC_Table2.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label replace
*Replications using CLR pre-decision salience measure
*continuous measure
logit decisionDirection c.zcourt c.zmood##i.lat##c.CLR_early c.zcong##i.lat##c.CLR_early i.naturalCourt, r
outreg2 using JLC_Table2.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append
*dichotomized measure
logit decisionDirection c.zcourt c.zmood##i.lat##i.pre3 c.zcong##i.lat##i.pre3 i.naturalCourt, r
outreg2 using JLC_Table2.doc, dec(2) paren(se) alpha(0.001, 0.01, 0.05) label append

*Replicate Hall's in-text Wald test
logit decisionDirection c.zcourt c.zmood##i.lat##i.nyt c.zcong##i.lat##i.nyt i.naturalCourt##i.nyt##i.lat, r
test zmood + 1.lat#c.zmood + c.zmood#1.nyt + 1.lat#c.zmood#1.nyt = 0 /* p = 0.0023 */
test zcong + 1.lat#c.zcong + c.zcong#1.nyt + 1.lat#c.zcong#1.nyt = 0 /* p = 0.0741 */
logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if nyt==1, r
test zmood + 1.lat#c.zmood = 0 /* p = 0.0021 */
test zcong + 1.lat#c.zcong = 0 /* p = 0.0600 */
*Replicate Hall's in-text Wald test w/ CLR pre-dec salience measure
logit decisionDirection c.zcourt c.zmood##i.lat##i.pre3 c.zcong##i.lat##i.pre3 i.naturalCourt, r
test zmood + 1.lat#c.zmood + c.zmood#1.pre3 + 1.lat#c.zmood#1.pre3 = 0 /* p = 0.0132 */
test zcong + 1.lat#c.zcong + c.zcong#1.pre3 + 1.lat#c.zcong#1.pre3 = 0 /* p = 0.1025 */
logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if pre3==1, r
test zmood + 1.lat#c.zmood = 0 /* p = 0.0158 */
test zcong + 1.lat#c.zcong = 0 /* p = 0.3605 */
*** NOTE: the p-values reported here are two-tailed tests; I follow Hall and report one-tailed tests in text

* Figures: Comparison of old v. new
*Replicate Hall (2014: Fig 1)
quietly logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if nyt==1, r
margins, at(lat==1 zmood=(-2(.2)2)) at(lat==0 zmood=(-2(.2)2)) vsquish level(95) noestimcheck
marginsplot, ylin(0) scheme(s1mono) name(Fig1_Orig)
*Replicate Hall (2014: Fig 2)
quietly logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if nyt==1, r
margins, at(lat==1 zcong=(-2(.2)2)) at(lat==0 zcong=(-2(.2)2)) vsquish level(95) noestimcheck
marginsplot, ylin(0) scheme(s1mono) name (Fig2_Orig)
* Replicate Fig 1 with CLR predecision salience measure, dichotomous
quietly logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if pre3==1, r
margins, at(lat==1 zmood=(-2(.2)2)) at(lat==0 zmood=(-2(.2)2)) vsquish level(95) noestimcheck
marginsplot, ylin(0) scheme(s1mono) name (Fig1_Rep)
* Replicate Fig 2 with CLR predecision salience measure, dichotomous
quietly logit decisionDirection c.zcourt c.zmood##i.lat c.zcong##i.lat i.naturalCourt##i.lat if pre3==1, r
margins, at(lat==1 zcong=(-2(.2)2)) at(lat==0 zcong=(-2(.2)2)) vsquish level(95) noestimcheck
marginsplot, ylin(0) scheme(s1mono) name (Fig2_Rep)
* Generate Figures for Side-by-side comparison
* Figure 1. Average Marginal Effects of Public Mood in Salient Cases
graph combine Fig1_Orig Fig1_Rep
* Figure 2. Average Marginal Effects of Congressional Ideology in Salient Cases
graph combine Fig2_Orig Fig2_Rep
